<?php
/**
 * @see ZendX_JQuery_View_Helper_UiWidget
 */
require_once "ZendX/JQuery/View/Helper/UiWidget.php";

/**
 * Помощник вида, реализующий списки с использованием плагина SelectBox
 * 
 * @category Phorm
 * @package JQuery_View_Helper
 * @name /Phorm/JQuery/View/Helper/SelectBox.php
 * @copyright phorm.ru
 * @since 06.11.2012
 * @author vladimir@kachalov.net
 */

class Phorm_JQuery_View_Helper_SelectBox extends ZendX_JQuery_View_Helper_UiWidget {
	
	public function selectBox($name, $value = null, $attribs = null, $options = null, $listsep = "<br />\n") {
		
		$params = $this->_prepareAttributes($name, $value, $attribs);
		
		$this->jquery->addJavascriptFile($this->view->BaseUrl().'/ui/selectbox/jquery.selectBox.min.js');
		$this->jquery->addStyleSheet($this->view->BaseUrl().'/ui/selectbox/jquery.selectBox.css');
		
		$js = sprintf('%s("#%s").selectBox();',
            ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(),
            $params['id']
        );
        $this->jquery->addOnLoad($js);
		
		return $this->view->formSelect($name, $value, $attribs, $options, $listsep);
		
	}
	
}